<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="./jquery.min.js"></script>
	</head>
	<body>
		
		<div>商品编号：<span id="itemID"></span></div>
		<div>商品价格：<span id="itemPrice"></span></div>
		
	
	</body>
	
	<script>
		//jquery提供ajax，参数是一个js对象{},对象之间用，号隔开
		$.ajax({
			type:"post", 
			url:"https://p.3.cn/prices/mgets",
			data:{
				"skuIds":"J_100003717483"
						},
			  contentType:"application/json;charset=utf-8",
			  dataType:"jsonp",
			  success:function(data){
				  			console.log("访问成功")
							console.log(data)
							 
							 //解析id和price
							 var item=data[0];
							 $(#" itemID")=item.id;
							 var itemPrice=item.p;
							 
							 var id=$("#itemID");
							 id.css("color","green");
							 var price=$("#itemPrice");
							 price.css("color","red");
							  },
			 error:function(e){
				 console.log("访问失败")
			 }
		})
		
	</script>
	
</html>
